<template>
  <div class="login-container">
    <CanvsBg />
    <div class="content-box">
      <div class="switch-lang">
        <lang-select is-btn />
      </div>
      <div class="loginImg">
        <!-- <img src="/img/login_banner.png" style="height:100%; width:100%"> -->
        <svg-icon icon-class="logo" />
        <el-image src="/img/login_img.png" />
      </div>
      <div class="form-box">
        <div class="title-container">
          <h3 class="title">{{ $t('login.title') }}</h3>
        </div>
        <transition name="rotate-x" appear mode="out-in">
          <component :is="currentComponent" />
        </transition>
      </div>
    </div>

    <div class="app-qr-codes">
      <el-tooltip placement="top">
        <div slot="content">
          <el-image src="/img/QrCode/android/qrcode.png" />
        </div>
        <el-button type="text">
          <svg-icon icon-class="android" />
        </el-button>
      </el-tooltip>
      <el-tooltip placement="top">
        <div slot="content">
          <el-image src="/img/QrCode/ios/qrcode.png" />
        </div>
        <el-button type="text">
          <svg-icon icon-class="ios" />
        </el-button>
      </el-tooltip>
    </div>
    <div class="footer-copyright">
      {{ copyRight }}
      &nbsp;&nbsp;
      <router-link to="terms">{{ $t('global.terms') }}</router-link>
      &nbsp;&nbsp;
      <router-link to="privacy"> {{ $t('global.privacy') }}</router-link>
    </div>
    <div class="record-n-varchar">
      <img src="/logo/备案图标.png">
      <a href="http://beian.miit.gov.cn">蜀ICP备2020028018号-1</a>
    </div>
  </div>
</template>

<script>
import CanvsBg from '@/components/Canvas'
import LangSelect from '@/components/LangSelect'
import defaultSetting from '@/settings'
import { mapGetters } from 'vuex'
import PwdLogin from './components/PwdLogin'
import NoteLogin from './components/NoteLogin'
import RecoverPwd from './components/RecoverPwd'
import ResetPwd from './components/ResetPwd'

const { copyRight } = defaultSetting

export default {
  name: 'Login',
  components: {
    CanvsBg,
    LangSelect,
    PwdLogin,
    NoteLogin,
    RecoverPwd,
    ResetPwd
  },
  provide() {
    return {
      changeComponent: this.changeComponent
    }
  },
  data() {
    return {
      copyRight: `${copyRight}${this.$t('global.companyName')}`,
      currentComponent: 'PwdLogin'
    }
  },
  computed: {
    ...mapGetters(['loading'])
  },
  mounted() {},
  methods: {
    changeComponent(v) {
      this.currentComponent = v
    }
  }
}
</script>

<style lang="scss" scoped>
.login-container {
  background-color: #fff;
  overflow: hidden;
  // 内容
  .content-box {
    display: flex;
    width: 800px;
    margin: 45vh auto auto;
    transform: translateY(-50%);
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.14);
    border-radius: 4px 0px 0px 4px;
    position: relative;

    .switch-lang {
      position: absolute;
      right: 0;
      top: 0;
    }
    .loginImg {
      width: 50%;
      font-size: 100px;
      background: #f7f8fa;

      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }
    .form-box {
      width: 50%;
      padding: 6% 8%;
      background: #fff;
    }
  }

  .title-container {
    position: relative;

    .title {
      font-size: 26px;
      color: #000;
      margin: 0px auto 40px auto;
      text-align: center;
    }
  }

  // 下载 app 的 二维码
  .app-qr-codes {
    position: fixed;
    width: 100%;
    text-align: right;
    padding-right: 20px;
    z-index: 99;
    .el-button {
      font-size: 30px;
    }
  }
  // 页脚版权
  .footer-copyright {
    position: fixed;
    bottom: 20px;
    text-align: center;
    /* left: 50%; */
    /* right: 50%; */
    width: 100%;
    line-height: 100px;
    color: #999;
  }
  // 备案号
  .record-n-varchar {
    position: fixed;
    bottom: 20px;
    text-align: center;
    /* left: 50%; */
    /* right: 50%; */
    width: 100%;
    color: #999;
  }
}

// .slide-fade-enter {
//   transform: translateX(50px);
//   opacity: 0;
// }
// .slide-fade-leave-to {
//   /* .slide-fade-leave-active for below version 2.1.8 */
//   transform: translateX(-50px);
//   opacity: 0;
// }
</style>
